package com.zshan.clinic.admin.mapper.stock;


import com.zshan.clinic.admin.entity.dto.StockOrderPurchaseDTO;
import com.zshan.clinic.admin.entity.vo.StockOrderPurchasePageVo;
import com.zshan.clinic.admin.entity.vo.StockOrderPurchaseVo;
import com.zshan.clinic.admin.entity.vo.StockOrderReqPageVo;
import com.zshan.clinic.admin.entity.vo.StockOrderReqVo;
import com.zshan.clinic.database.model.StockOrderPurchaseDetail;
import com.zshan.clinic.database.model.StockOrderReqDetail;
import com.zshan.clinic.mybatis.SuperMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface SpecStockOrderMapper extends SuperMapper {

    /**
     * 查询采购单数量
     * @param orderNo
     * @param orderStatus
     * @param settleStatus
     * @param storageId
     * @return
     */
    Long getOrderPurchaseCount(@Param("clinicId") Long clinicId,
                               @Param("orderNo") String orderNo,
                               @Param("orderStatus") String orderStatus,
                               @Param("settleStatus") String settleStatus,
                               @Param("storageId") Long storageId);

    /**
     * 查询采购单列表
     * @param orderNo
     * @param orderStatus
     * @param settleStatus
     * @param storageId
     * @param offset
     * @param limit
     * @return
     */
    List<StockOrderPurchasePageVo> getOrderPurchaseList(@Param("clinicId") Long clinicId,
                                                        @Param("orderNo") String orderNo,
                                                        @Param("orderStatus") String orderStatus,
                                                        @Param("settleStatus") String settleStatus,
                                                        @Param("storageId") Long storageId,
                                                        @Param("offset") Integer offset,
                                                        @Param("limit") Integer limit);

    /**
     * 获取采购单详情
     * @param clinicId
     * @param orderId
     * @return
     */
    StockOrderPurchaseVo getOrderPurchaseDetail(@Param("clinicId") Long clinicId,
                                                @Param("orderId") Long orderId);

    /**
     * 批量添加采购明细
     * @param detailList
     */
    void addPurchaseDetailsBatch(@Param("detailList") List<StockOrderPurchaseDetail> detailList);

    /**
     * 查询采购订单
     * @param clinicId
     * @param orderId
     * @return
     */
    StockOrderPurchaseDTO getStockOrderPurchaseDTO(@Param("clinicId") Long clinicId,
                                                   @Param("orderId") Long orderId);

    /**
     * 批量添加领用明细
     * @param detailList
     */
    void addReqDetailsBatch(@Param("detailList") List<StockOrderReqDetail> detailList);

    /**
     * 查询领用单明细
     * @param clinicId
     * @param orderId
     * @return
     */
    StockOrderReqVo getOrderReqDetail(@Param("clinicId") Long clinicId,
                                      @Param("orderId") Long orderId);

    /**
     * 查询领用单数量
     * @param clinicId
     * @param orderNo
     * @param orderStatus
     * @param deptId
     * @param storageId
     * @return
     */
    Long getOrderReqCount(@Param("clinicId") Long clinicId,
                          @Param("orderNo") String orderNo,
                          @Param("orderStatus") String orderStatus,
                          @Param("deptId") Long deptId,
                          @Param("storageId") Long storageId);

    /**
     * 查询领用单列表
     * @param clinicId
     * @param orderNo
     * @param orderStatus
     * @param deptId
     * @param storageId
     * @param offset
     * @param limit
     * @return
     */
    List<StockOrderReqPageVo> getOrderReqList(@Param("clinicId") Long clinicId,
                                              @Param("orderNo") String orderNo,
                                              @Param("orderStatus") String orderStatus,
                                              @Param("deptId") Long deptId,
                                              @Param("storageId") Long storageId,
                                              @Param("offset") Integer offset,
                                              @Param("limit") Integer limit);
}
